﻿using Sys.Core.Sys;
using Sys.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sys.Core.Gen
{
    /// <summary>
    /// 新闻业务
    /// </summary>
    public class NewBll : ExampleBase<GenNew, NewBll>
    {
        /// <summary>
        /// 根据分类标记获取新闻
        /// </summary>
        /// <param name="tag">分类标记</param>
        /// <returns>符合条件的新闻数据</returns>
        public IQueryable<GenNew> NewsByTag(string tag)
        {
            var dic = DictionaryBll.I.Entities.FirstOrDefault(m => m.Tag.Equals(tag));

            var list = Entities.Where(m => m.DictionaryID.Equals(dic.ID));

            return list.OrderByDescending(m => m.Top).ThenByDescending(m => m.UpdateTime);
        }
    }
}